home *** CD-ROM | disk | FTP | other *** search
- COMMENT ;
-
- FCD.ASM The assembly language routines for FONTCODE.BAS
- version 2.1, a tool for use with fonts used with the
- banner program FONTSY. Assemble this with MASM version
- 4.0 and link with FONTCODE.OBJ using the /E (exepack)
- switch. The main program is written for the
- Microsoft QuickBASIC compiler version 2.0.
-
- ;
- DATA SEGMENT BYTE PUBLIC 'DATA'
-
- ;-----------------------------------------------------------------------------
- NO EQU 0
- YES EQU NOT NO
-
- ;Set to YES if you are going to use a snowy color card
-
- NoSnow EQU YES
-
- ;-----------------------------------------------------------------------------
- ; 0 BLACK 4 RED 8 GRAY 12 LIGHT RED
- ; 1 BLUE 5 MAGENTA 9 LIGHT BLUE 13 LIGHT MAGENTA
- ; 2 GREEN 6 BROWN 10 LIGHT GREEN 14 YELLOW
- ; 3 CYAN 7 WHITE 11 LIGHT CYAN 15 HIGH-INTENSITY WHITE
-
- ; Location Used
- CyanOnBlack EQU 0BH ;abort, hold option 1 prompt
- GreenOnBlack EQU 0AH ;most text
- RedOnBlack EQU 0CH ;error messages
- CyanOnGreen EQU 2BH ;option 2 title
- CyanOnRed EQU 4BH ;setdef4 title
- CyanOnMagenta EQU 5BH ;setdef7 title
- YellowOnBlue EQU 1EH ;program title
- YellowOnCyan EQU 3EH ;option 3 title
- YellowOnRed EQU 4EH ;option 4 title
- YellowOnMagenta EQU 5EH ;option 5 title
- YellowOnBrown EQU 6EH ;option 6 title
- WhiteOnBlue EQU 1FH ;setdef1 title
- WhiteOnGreen EQU 2FH ;setdef2 title
- WhiteOnCyan EQU 3FH ;setdef3 title
- WhiteOnRed EQU 4FH ;Loading Font, setdef4 title
- WhiteOnMagenta EQU 5FH ;setdef5 title
- WhiteOnBrown EQU 6FH ;setdef6 title
-
- MonoSegAddr EQU 0B000H ;address of monochrome buffer
- GraphSegAddr EQU 0B800H ;address of graphics buffer
- ;-----------------------------------------------------------------------------
- TitleDat DB ' ╔',76 DUP (205),'╗ '
- DB ' ║ FONTCODE version 2.1 9/6/86 (C) 1985,'
- DB ' 1986 Merlin R. Null ║ '
- DB ' ╚',76 DUP (205),'╝ ',0
-
- MenuText DB 'The current font is:',30,30,1
- DB 'Title:',31,31,1,1,1,1,1,1,1,21
- DB '1. Load an existing font (encoded)',30,16
- DB '2. Load a full set of font characters (text)',30,6
- DB '3. Open a new font',30,30,2
- DB '4. Load a single font character (text)',30,12
- DB '5. Unload a single character from the current font'
- DB 30
- DB '6. Unload all of the current font to text files'
- DB 30,3
- DB '7. Save the current font',30,26
- DB '8. Change font defaults',30,27
- DB '9. Modify font text files (menu #2)',30,6,1
- DB 'Option (1-9) or <Esc> to exit ?',0
-
- DescText DB 'Encodes or decodes font data files used with the'
- DB ' FONTSY banner printer',0
-
- AvailText DB 'Characters included in this font are:',0
-
- FrameDat DB ' ╔',31 DUP (205),'╗ ',30,15
- DB ' ║ ',29,' ║ ',30,15
- DB ' ╚',31 DUP (205),'╝ ',0
-
- Opt1Text DB 'Encoded font to load ?',0
-
- Opt1aText DB ' ╔',18 DUP (205),'╗ ',30,28
- DB ' ║ Loading Font ║ ',30,28
- DB ' ╚',18 DUP (205),'╝ ',0
-
- Opt2Text DB 'Font to encode ?',0
-
- Opt2Title DB ' ╔',48 DUP (205),'╗ ',28
- DB ' ║ Loading a full set of font characters (text) ║ '
- DB 28
- DB ' ╚',48 DUP (205),'╝ ',0
-
- Opt2aText DB 'Go take a break, this will take a while',23,1,30
- DB '<Esc> to Abort',30,1,1,1,26
- DB 'Working on',0
-
- Opt3Title DB ' Open a New Font ',0
-
- Opt3Text DB 'Enter the file name of your font. If no extension '
- DB 'is specified,',16,1
- DB 'the default of FNT will be used. A path may be '
- DB 'included.',30,4,1,1
- DB 'A bare <Return> exits to the main menu.',20,1,1,25
- DB 'Example: B:\source\BRILLIG.FNT',26,1,1,1,1,1,1
- DB 'Font Name ?',0
-
- Opt4Title DB 'Load a single font character ',0
-
- Opt4Text DB 'Enter with a single keystroke the character file'
- DB ' you wish to load',30,1,3
- DB '<Esc> to return to the main menu',0
-
- Opt5Title DB ' Unload a single character ',0
-
- Opt5Text DB 'To unload a single character to a text file from '
- DB 'the current font',15
- DB 'enter with a single keystroke, the character you '
- DB 'want decoded.',1,31
- DB 'Press <Esc> to return to the main menu',0
-
- Opt6Title DB ' Unload all of current font ',0
-
- Opt6Text DB 'Current font is:',30,1,18
- DB 'This will take a while and use a lot of disk space. '
- DB ' For a full',17
- DB 'font you will need from 100k to over 200k of free '
- DB 'disk space',20
- DB 'and a free directory entry for each character of the'
- DB ' font.',22,1,1
- DB '1 Toggle height is:',24,30,1
- DB '2 Toggle width is:',24,30,1
- DB '<Esc> Return to main menu',25,30,1
- DB '<Return> to create text files',13,30,1,1,1,1
- DB 'Option or <Return> to continue ?',0
-
-
- Opt6aText DB 'Output font is:',31,1,1,31,8
- DB '<Esc> to abort',31,1,1,1,29
- DB 'Unloading character:',0
-
- Opt9Title DB ' Modify font text files ',0
-
- Opt9Text DB 'For modifying banner font source files',29,1
- DB '1. Rotate a single output file 180 degrees',30,8,1
- DB '2. Rotate a single output file 90 degrees clockwise'
- DB 29,1
- DB '3. Invert line order of a single file',30,13,1
- DB '4. Rotate full font 180 degrees',30,19,1
- DB '5. Rotate full font 90 degrees clockwise',30,10,1
- DB '6. Invert line order of a full font',30,7,1
- DB 'Option or <Esc> to exit ?',0
-
- InPromptDat DB 'Input filename or <Return> to abort ?',0
-
- OutPromptDat DB 'Output filename or <Return> to abort ?',0
-
- OvrWrtPrmptDat DB 'The output file already exists',30,20
- DB 'Do you wish to overwrite it ?',0
-
- InEquOutDat DB 'The Output filename must not be the same as the '
- DB 'Input filename!',0
-
- SetDef1Title DB ' Enter Title ',0
- SetDef1Text DB 'Is:',1,1,1,1,8
- DB 'Enter a title or copyright notice for the font. It'
- DB ' must',24,1
- DB 'not exceed 70 characters. Enter <Return> to keep '
- DB 'the',27,1
- DB 'existing title, if one exists. Example:',29,1,1,11
- DB 'Heron version 1.0 (C) 1985 Merlin R. Null'
- DB 28,1,1,1,1,1
- DB 'Title ?',0
-
- SetDef2Title DB ' Enter Comments or Subtitle ',0
- SetDef2Text DB 'Is:',1,1,1,1,1,8
- DB 'One additional line of comments or a font subtitle '
- DB 'may be',23,1
- DB 'entered. Enter <Return> to retain existing comment '
- DB 'line',24,1
- DB 'or 999 to leave it blank.'
- DB 30,1,1,1,1,1,1,1,14
- DB 'Comment ?',0
-
- SetDef3Title DB ' Set Default Print Character ',0
- SetDef3Text DB 'Is:',1,1,1,30,21
- DB 'The single character used by FONTSY to print all '
- DB 'large letters can',13,1
- DB 'be set to any printable character. Use a single '
- DB 'keystroke OR enter',13,1
- DB 'a minimum of two decimal numbers to use the ASCII '
- DB 'value. Example:',13,1
- DB 'Character 239 on the Gemini-10X is a 6 by 6 graphic '
- DB 'square. Enter',13,1
- DB '255 to print each large character with its'
- DB ' own small character.',31,1
- DB '<Return> retains the current value',26,1,1
- DB 'Character or decimal value ?',0
-
- SetDef4Title DB ' Set Margin ',0
- SetDef4Text DB 'Is:',1,1,1,30,22
- DB 'A margin may be set below the font by printing'
- DB ' the lowest',23,1
- DB 'element of the font at some value other than'
- DB ' column 1.',31,1,1
- DB 'Enter <Return>, to retain the current number.'
- DB 20,1,1,1,1,1,1,1
- DB 'Column to start printing ?',0
-
- SetDef5Title DB ' Rows Between Characters ',0
- SetDef5Text DB 'Is:',30,1,1,1,1,1,17
- DB 'The number of rows between large characters may be '
- DB 'set from 0 to 99.',12,1
- DB 'A value of 3 works well for most fonts.',30,23,1
- DB '<Return> retains the current value',29,1,1,1,1,1,1
- DB 'Number of rows ?',0
-
- SetDef6Title DB ' Printer Initialiaztion ',0
- SetDef6Text DB 'An initialization string may be optionally sent to '
- DB 'the printer',18
- DB 'to set pitch, linefeeds or other funtions. This may'
- DB ' be set to',18
- DB 'different values for each font. Please consult '
- DB 'your printer',19
- DB 'manual for details.',0
-
- PrnStringText DB 'Enter each byte of the printer command string with '
- DB 'the decimal value',12
- DB 'of each character. Terminate input with a bare '
- DB '<Return>. Enter 999',12
- DB 'to have no printer string sent. A bare <Return> '
- DB 'for the first byte',13
- DB 'of the input causes the old string to be retained.',0
-
- SetDef7Title DB ' Printer Reset String ',0
- SetDef7Text DB 'A printer reset string should be sent to set printer'
- DB ' back to',20
- DB 'defaults. It is preferable to reset all functions '
- DB 'set with',21
- DB 'the initialization string rather than use a command '
- DB 'to reset',20
- DB 'everything.',0
-
- SetDef8Title DB ' Font Magnification ',0
- SetDef8Text DB 'Multiply or divide the number of rows or columns'
- DB ' printed. For new',14,1
- DB 'fonts these are usually set to single. Other values'
- DB ' are mostly used',12,1
- DB 'at run time. <Return> here accepts the displayed'
- DB ' values.',30,1,1
- DB '1 Change Horizontal size (rows) is:',30,12,1,1
- DB '2 Change Vertical size (columns) is:',29,1,1,1,1
- DB 'Option or <Return> ?',0
-
-
- AbortText DB '*** ABORTING *** per operator request',0
-
- HoldText DB '<Press any key to continue>',0
-
- NoFilesText DB 'No files found for',0
- NoFiles2Text DB 'Filenames to be included should have the format:'
- DB 30,2,1
- DB 'Fontname + decimal number of the character to '
- DB 'include.',26,1
- DB 'Example: KIWI.065 = the letter "A" for the font'
- DB 30,2,1
- DB 'Kiwi. This is followed by KIWI.066, KIWI.067 etc.',0
-
- ;-----------------------------------------------------------------------------
- DisplayTable DB 2DH,29H ;display re-enable values for
- ; modes 2 and 3
- AtrByte DB 0
- ;-----------------------------------------------------------------------------
- DATA ENDS
-
- DGROUP GROUP DATA
-
- CODE SEGMENT BYTE PUBLIC 'CODE'
- ASSUME CS:CODE, DS:DGROUP
-
- PUBLIC MenuScreen,Description,AvailChars,Opt1Prompt
- PUBLIC LoadingFont,Opt2Prompt,Opt2Screen
- PUBLIC Opt3Screen,Opt4Screen,Opt5Screen
- PUBLIC Opt6Screen,Opt6aScreen,Opt9Screen
- PUBLIC InFilePrompt,OutFilePrompt,OvrWrtPrmpt,InEquOut
- PUBLIC SetDef1Screen,SetDef2Screen,SetDef3Screen
- PUBLIC SetDef4Screen,SetDef5Screen,SetDef6Screen
- PUBLIC SetDef7Screen,SetDef8Screen,Hold,Abort,NoFiles
- PUBLIC WindowScroll,ClearToEOS
-
- Main PROC FAR
-
- MenuScreen: PUSH BP
- MOV BP,SP
- CALL ClrScr
- MOV AtrByte,YellowOnBlue
- LEA SI,TitleDat
- XOR DX,DX ;row 0 column 0
- CALL IsrtStr
- MOV AtrByte,GreenOnBlack
- LEA SI,MenuText
- MOV DX,0301H ;row 3 column 1
- CALL IsrtStr
- POP BP
- RET
- ;-----------------------------------------------------------------------------
- Description: PUSH BP
- MOV BP,SP
- MOV AtrByte,GreenOnBlack
- LEA SI,DescText
- MOV DX,0905H ;row 9 column 5
- CALL IsrtStr
- POP BP
- RET
- ;-----------------------------------------------------------------------------
- AvailChars: PUSH BP
- MOV BP,SP
- MOV AtrByte,GreenOnBlack
- LEA SI,AvailText
- MOV DX,0815H ;row 8 column 21
- CALL IsrtStr
- POP BP
- RET
- ;-----------------------------------------------------------------------------
- Opt1Prompt: PUSH BP
- MOV BP,SP
- CALL ClearPrompt
- MOV AtrByte,CyanOnBlack
- LEA SI,Opt1Text
- MOV DX,1700H ;row 23 column 0
- CALL IsrtStr
- POP BP
- RET
- ;-----------------------------------------------------------------------------
- LoadingFont: PUSH BP
- MOV BP,SP
- MOV AtrByte,WhiteOnRed
- LEA SI,Opt1aText
- MOV DX,0D10H ;row 13 column 16
- CALL IsrtStr
- POP BP
- RET
- ;-----------------------------------------------------------------------------
- Opt2Prompt: PUSH BP
- MOV BP,SP
- CALL ClearPrompt
- MOV AtrByte,CyanOnBlack
- LEA SI,Opt2Text
- MOV DX,1700H ;row 23 column 0
- CALL IsrtStr
- POP BP
- RET
- ;-----------------------------------------------------------------------------
- Opt2Screen: PUSH BP
- MOV BP,SP
- CALL ClrScr
- MOV AtrByte,CyanOnGreen
- LEA SI,Opt2Title
- MOV DX,000EH ;row 0 column 14
- CALL IsrtStr
- MOV AtrByte,GreenOnBlack
- LEA SI,Opt2aText
- MOV DX,0914H ;row 9 column 20
- CALL IsrtStr
- POP BP
- RET
- ;-----------------------------------------------------------------------------
- Opt3Screen: PUSH BP
- MOV BP,SP
- MOV AtrByte,YellowOnCyan
- CALL FRAME
- LEA SI,Opt3Title
- MOV DX,0119H ;row 1 column 25
- CALL IsrtStr
- MOV AtrByte,GreenOnBlack
- LEA SI,Opt3Text
- MOV DX,0808H ;row 8 column 8
- CALL IsrtStr
- POP BP
- RET
- ;-----------------------------------------------------------------------------
- Opt4Screen: PUSH BP
- MOV BP,SP
- MOV AtrByte,YellowOnRed
- CALL FRAME
- LEA SI,Opt4Title
- MOV DX,0119H ;row 1 column 25
- CALL IsrtStr
- MOV AtrByte,GreenOnBlack
- LEA SI,Opt4Text
- MOV DX,0405H ;row 04 column 5
- CALL IsrtStr
- POP BP
- RET
- ;-----------------------------------------------------------------------------
- Opt5Screen: PUSH BP
- MOV BP,SP
- MOV AtrByte,YellowOnMagenta
- CALL FRAME
- LEA SI,Opt5Title
- MOV DX,0119H ;row 1 column 25
- CALL IsrtStr
- MOV AtrByte,GreenOnBlack
- LEA SI,Opt5Text
- MOV DX,0408H ;row 4 column 8
- CALL IsrtStr
- POP BP
- RET
- ;-----------------------------------------------------------------------------
- Opt6Screen: PUSH BP
- MOV BP,SP
- MOV AtrByte,YellowOnBrown
- CALL FRAME
- LEA SI,Opt6Title
- MOV DX,0119H ;row 1 column 25
- CALL IsrtStr
- MOV AtrByte,GreenOnBlack
- LEA SI,Opt6Text
- MOV DX,0518H ;row 5 column 24
- CALL IsrtStr
- POP BP
- RET
- ;-----------------------------------------------------------------------------
- Opt6aScreen: PUSH BP
- MOV BP,SP
- LEA SI,Opt6aText
- MOV DX,0C19H ;row 12 column 25
- CALL IsrtStr
- POP BP
- RET
- ;-----------------------------------------------------------------------------
- Opt9Screen: PUSH BP
- MOV BP,SP
- CALL ClrScr
- MOV AtrByte,YellowOnBlue
- CALL Frame
- LEA SI,Opt9Title
- MOV DX,0119H ;row 1 column 25
- CALL IsrtStr
- MOV AtrByte,GreenOnBlack
- LEA SI,Opt9Text
- MOV DX,0315H ;row 3 column 21
- CALL IsrtStr
- POP BP
- RET
- ;--------------------------------------------------------------------
- InFilePrompt: PUSH BP
- MOV BP,SP
- LEA SI,InPromptDat
- MOV DX,1300H ;row 19 column 0
- CALL IsrtStr
- POP BP
- RET
- ;--------------------------------------------------------------------
- OutFilePrompt: PUSH BP
- MOV BP,SP
- LEA SI,OutPromptDat
- MOV DX,1500H ;row 21 column 0
- CALL IsrtStr
- POP BP
- RET
- ;--------------------------------------------------------------------
- OvrWrtPrmpt: PUSH BP
- MOV BP,SP
- MOV AtrByte,RedOnBlack
- LEA SI,OvrWrtPrmptDat
- MOV DX,1600H ;row 22 column 0
- CALL IsrtStr
- MOV AtrByte,GreenOnBlack
- POP BP
- RET
- ;--------------------------------------------------------------------
- InEquOut: PUSH BP
- MOV BP,SP
- MOV AtrByte,RedOnBlack
- LEA SI,InEquOutDat
- MOV DX,1600H ;row 22 column 0
- CALL IsrtStr
- MOV AtrByte,GreenOnBlack
- POP BP
- RET
- ;-----------------------------------------------------------------------------
- ;Set Font Title Screen
-
- SetDef1Screen: PUSH BP
- MOV BP,SP
- MOV AtrByte,WhiteOnBlue
- CALL FRAME
- LEA SI,SetDef1Title
- MOV DX,0119H ;row 1 column 25
- CALL IsrtStr
- MOV AtrByte,GreenOnBlack
- LEA SI,SetDef1Text
- MOV DX,0600H ;row 6 column 0
- CALL IsrtStr
- POP BP
- RET
- ;-----------------------------------------------------------------------------
- ;Enter Comments Screen
-
- SetDef2Screen: PUSH BP
- MOV BP,SP
- MOV AtrByte,WhiteOnGreen
- CALL FRAME
- LEA SI,SetDef2Title
- MOV DX,0119H ;row 1 column 25
- CALL IsrtStr
- MOV AtrByte,GreenOnBlack
- LEA SI,SetDef2Text
- MOV DX,0600H ;row 6 column 0
- CALL IsrtStr
- POP BP
- RET
- ;-----------------------------------------------------------------------------
- SetDef3Screen: PUSH BP
- MOV BP,SP
- MOV AtrByte,WhiteOnCyan
- CALL FRAME
- LEA SI,SetDef3Title
- MOV DX,0119H ;row 1 column 25
- CALL IsrtStr
- MOV AtrByte,GreenOnBlack
- LEA SI,SetDef3Text
- MOV DX,0621H ;row 6 column 33
- CALL IsrtStr
- POP BP
- RET
- ;-----------------------------------------------------------------------------
- SetDef4Screen: PUSH BP
- MOV BP,SP
- MOV AtrByte,WhiteOnRed
- CALL FRAME
- LEA SI,SetDef4Title
- MOV DX,0119H ;row 1 column 25
- CALL IsrtStr
- MOV AtrByte,GreenOnBlack
- LEA SI,SetDef4Text
- MOV DX,0623H ;row 6 column 35
- CALL IsrtStr
- POP BP
- RET
- ;-----------------------------------------------------------------------------
- SetDef5Screen: PUSH BP
- MOV BP,SP
- MOV AtrByte,WhiteOnMagenta
- CALL FRAME
- LEA SI,SetDef5Title
- MOV DX,0119H ;row 1 column 25
- CALL IsrtStr
- MOV AtrByte,GreenOnBlack
- LEA SI,SetDef5Text
- MOV DX,0623H ;row 6 column 35
- CALL IsrtStr
- POP BP
- RET
- ;-----------------------------------------------------------------------------
- SetDef6Screen: PUSH BP
- MOV BP,SP
- MOV AtrByte,WhiteOnBrown
- CALL FRAME
- LEA SI,SetDef6Title
- MOV DX,0119H ;row 1 column 25
- CALL IsrtStr
- MOV AtrByte,GreenOnBlack
- LEA SI,SetDef6Text
- MOV DX,0406H ;row 4 column 6
- CALL IsrtStr
- LEA SI,PrnStringText
- MOV DX,0906H ;row 9 column 6
- CALL IsrtStr
- POP BP
- RET
- ;-----------------------------------------------------------------------------
- SetDef7Screen: PUSH BP
- MOV BP,SP
- MOV AtrByte,CyanOnMagenta
- CALL FRAME
- LEA SI,SetDef7Title
- MOV DX,0119H ;row 1 column 25
- CALL IsrtStr
- MOV AtrByte,GreenOnBlack
- LEA SI,SetDef7Text
- MOV DX,0406H ;row 4 column 6
- CALL IsrtStr
- LEA SI,PrnStringText
- MOV DX,0906H ;row 9 column 6
- CALL IsrtStr
- POP BP
- RET
- ;-----------------------------------------------------------------------------
- SetDef8Screen: PUSH BP
- MOV BP,SP
- MOV AtrByte,WhiteOnBlue
- CALL FRAME
- LEA SI,SetDef8Title
- MOV DX,0119H ;row 1 column 25
- CALL IsrtStr
- MOV AtrByte,GreenOnBlack
- LEA SI,SetDef8Text
- MOV DX,0806H ;row 8 column 6
- CALL IsrtStr
- POP BP
- RET
- ;-----------------------------------------------------------------------------
- Abort: PUSH BP
- MOV BP,SP
- MOV AtrByte,CyanOnBlack
- LEA SI,AbortText
- MOV DX,1515H ;row 21 column 21
- CALL IsrtStr
- POP BP
- RET
- ;-----------------------------------------------------------------------------
- Hold: PUSH BP
- MOV BP,SP
- CALL ClearPrompt
- MOV AtrByte,CyanOnBlack
- LEA SI,HoldText
- MOV DX,1719H ;row 23 column 25
- CALL IsrtStr
- CALL GetMode ;get crt mode
- CMP AL,7 ;is it monochrome
- JNE ColorCursor
- MOV CX,0C0DH ;cursor lines 12 & 13
- MOV AH,1 ;set cursor type function
- INT 10H
- JMP SHORT Hold2
-
- ColorCursor: MOV CX,0607H ;cursor lines 6 & 7
- MOV AH,1 ;set cursor type function
- INT 10H
- Hold2: MOV DX,1735H ;row 23 column 53
- CALL Locate ;move cursor
- XOR AH,AH ;get a keypress
- INT 16H ;BIOS keyboard input
- POP BP
- RET
- ;-----------------------------------------------------------------------------
- NoFiles: PUSH BP
- MOV BP,SP
- CALL ClrScr
- MOV AtrByte,RedOnBlack
- LEA SI,NoFilesText
- MOV DX,0313H ;row 3 column 19
- CALL IsrtStr
- MOV AtrByte,GreenOnBlack
- LEA SI,NoFiles2Text
- MOV DX,070BH ;row 7 column 11
- CALL IsrtStr
- POP BP
- RET
- ;-----------------------------------------------------------------------------
- ;Clear To End Of Screen Pass starting line of clear (0-23) in
- ; variable StartLine
-
- ClearToEOS: PUSH BP
- MOV BP,SP
- MOV BX,[BP]+6
- MOV CH,[BX] ;get start row
- XOR CL,CL ;column 0
- MOV DX,174FH ;lower right row 23 col 79
- MOV BH,7 ;normal screen attribute
- MOV AX,0600H ;scroll active page
- INT 10H ;call BIOS
- POP BP
- RET 2
- ;--------------------------------------------------------------------
- ;Scroll Window area. Called from BASIC with ULCorner which is put
- ;in CX and LRCorner to DX
-
- WindowScroll: PUSH BP
- MOV BP,SP
- MOV BX,[BP]+8 ;upper left
- MOV CX,[BX]
- MOV BX,[BP]+6 ;lower right
- MOV DX,[BX]
- MOV BH,7 ;normal screen attribute
- MOV AX,0601H ;scroll active window 1 line
- INT 10H ;call BIOS
- POP BP
- RET 4
-
- Main ENDP
- ;*****************************************************************************
- ;************ Start of Routines Local to the Assembly Module *****************
- ;*****************************************************************************
- Frame PROC NEAR
- CALL ClrScr
- LEA SI,FrameDat
- MOV DX,0016H ;row 0 column 22
- CALL IsrtStr
- RET
- Frame ENDP
- ;-----------------------------------------------------------------------------
- ;Clear 24th Line (Prompt)
-
- ClearPrompt PROC NEAR
- MOV CX,1700H ;upper left (23,0)
- MOV DX,174FH ;lower right (23,79)
- MOV BH,7 ;normal screen attribute
- MOV AX,0600H ;scroll active page
- INT 10H ;call BIOS
- RET
- ClearPrompt ENDP
- ;-----------------------------------------------------------------------------
- ;Clear the Screen and Home
-
- ClrScr PROC NEAR
- XOR CX,CX ;upper left (0,0)
- MOV DX,184FH ;lower right (24,79)
- MOV BH,7 ;normal screen attribute
- MOV AX,0600H ;scroll active page
- INT 10H ;call BIOS
- XOR DX,DX ;row 0, column 0
- ;fall through to LOCATE
- ;-----------------------------------------------------------------------------
- ;Direct Cursor Addressing
- ; DX row, column
-
- Locate: MOV AH,2 ;request move cursor
- XOR BH,BH ;page #0
- INT 10H ;call BIOS
- RET
- ClrScr ENDP
- ;-----------------------------------------------------------------------------
- ;Insert String Directly in the Video Buffer
- ; SI string address DX row, column
- ; AtrByte holds color, foreground and background
-
- IsrtStr PROC NEAR
- PUSH ES
- IF NoSnow
- CALL VideoDisable ;turn display off for
- ; snow-free writing
- ENDIF
- CALL CalcVidOffset ;calc offset into video buffer
- MOV DI,AX ;offset was returned in AX
- MOV DH,AtrByte ;get the attribute byte
- CALL SetVidAddr ;set to monochrome or graphics
- MOV ES,AX ;video buffer address into ES
-
- IsrtLoop: MOV DL,BYTE PTR[SI]
- CMP DL,0
- JE IsrtStrExit ;exit if end of string
- CMP DL,31 ;control character?
- JA IsrtWord ;no, use the character
- CMP DL,1 ;if character 1
- JZ Skip80 ;skip next 80 print positions
- XOR DH,DH ;zero attribute byte
- SHL DX,1 ;skip number of print
- ADD DI,DX ;positions = ASCII value
- MOV DH,AtrByte ;restore attribute byte
- JMP SHORT NextByte
-
- Skip80: ADD DI,0A0H ;skip next 80 positions
- JMP SHORT NextByte
-
- IsrtWord: MOV ES:WORD PTR[DI],DX ;move char and attr to crt buf
-
- ADD DI,2 ;point to next crt buf loc
- NextByte: ADD SI,1 ;point to next string byte
- JMP SHORT IsrtLoop ;move another word
-
- IsrtStrExit:
- IF NoSnow
- CALL VideoEnable ;video back on if CGA
- ENDIF
- POP ES
- RET
- IsrtStr ENDP
- ;-----------------------------------------------------------------------------
- ;Set Video Address
-
- SetVidAddr PROC NEAR
- CALL GetMode ;get crt mode
- CMP AL,7 ;is it monochrome
- JNE ItsGraphics
- MOV AX,MonoSegAddr ;monochrome buffer seg addr
- RET
-
- ItsGraphics: MOV AX,GraphSegAddr ;graphics buffer seg address
- RET
- SetVidAddr ENDP
- ;-----------------------------------------------------------------------------
- ;Calculate Video Address
-
- CalcVidOffset PROC NEAR
- MOV AX,160 ;number of bytes in row
- MUL DH ;row * 160
- SHL DL,1 ;column * 2
- XOR DH,DH ;byte to word
- ADD AX,DX ;(row *160)+(column*2)
- MOV DI,AX ;set offset in DI
- RET
- CalcVidOffset ENDP
- ;-----------------------------------------------------------------------------
- ;Get Video Mode.
- ;Returns CRT mode in AL and the number of character columns on the
- ;screen in AH.
-
- GetMode PROC NEAR
- MOV AX,0F00H
- INT 10H
- RET
- GetMode ENDP
- ;-----------------------------------------------------------------------------
- ;VideoEnable and VideoDisable routines manipulate bit 3 of port 3D8h,
- ;the CGA Mode Control Register, to temporarily turn the display on or off.
- ;These routines write directly to hardware, and have no effect on other
- ;video adapters.
-
- IF NoSnow
- VideoDisable PROC NEAR
- PUSH DX
- CALL GetMode ;get crt mode
- CMP AL,7 ;is it monochrome
- JE Disable2
- MOV DX,3DAH ;read CGA status port
- Disable1: IN AL,DX ;wait for vertical retrace to
- ;occur
- TEST AL,8 ;is bit 3 set?
- JE Disable1 ;no, wait until it is
- MOV DX,3D8H ;now disable the display
- MOV AL,25H ;by clearing bit 3 of the Mode
- ; Control Register
- OUT DX,AL
- Disable2: POP DX
- RET
- VideoDisable ENDP
- ;-----------------------------------------------------------------------------
- VideoEnable PROC NEAR
- CALL GetMode ;get crt mode
- CMP AL,7 ;is it monochrome
- JE Enable2
- XOR AH,AH ;eliminate columns info
- MOV DX,3D8H ;CGA Mode Control Register
- MOV BX,AX ;video mode to BX
- SUB BX,2
- MOV AL,DisplayTable[BX]
- OUT DX,AL ;and send it to the port
- Enable2: RET
- VideoEnable ENDP
- ENDIF
- ;-----------------------------------------------------------------------------
- CODE ENDS
- END